﻿using System;
using System.Collections.Generic;
using System.Web;
using Huayou.Common;
using HySoft.Cash.Business;
using HySoft.Cash.Structure;

namespace PayRoller.Code
{
    public class MemberParent : CommonBasePage
    {
        /// <summary>
        /// 当前登录企业的ID
        /// </summary>
        public string OrgSid = "";

        private string orgName = string.Empty;
        /// <summary>
        /// 当前登录企业的名称
        /// </summary>
        public string OrgName
        { 
            get
            {
                if (orgName == string.Empty)
                {
                    if (OrgSid != string.Empty)
                    {
                        TorginfoBN obn = new TorginfoBN(this.Page);
                        TorginfoDT entity= obn.Get(Convert.ToInt32(OrgSid));
                        if (entity != null)
                        {
                            orgName = entity.OrgName;
                        }
                    }
                }
                return orgName;
            }
        }

        protected void CheckLogin()
        {
            if ((HttpContext.Current.Request.Cookies["Company.ID"] != null) && (HttpContext.Current.Request.Cookies["Company.ID"].Value != ""))
            {
                this.OrgSid = HttpContext.Current.Request.Cookies["Company.ID"].Value;
            }
            else
            {
                this.OrgSid = "";
                HttpContext.Current.Response.Redirect("~/Login.aspx");
            }
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
        }
    }
}
